package com.lins.framework.ui.home.download;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.AppCompatButton;
import android.support.v7.widget.Toolbar;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.lins.framework.R;
import com.lins.framework.mvpframe.base.BaseFrameActivity;
import com.lins.framework.utils.down.dialog.DownloadDialogFragment;
import com.lins.framework.utils.down.service.DownloadService;
import com.lins.framework.utils.toolbar.AppToolBar;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class DownloadActivity extends BaseFrameActivity<DownloadPresenter, DownloadModel>
        implements DownlaodContract.View {

    @BindView(R.id.id_toolbar)
    Toolbar idToolbar;

    @BindView(R.id.btn_download)
    AppCompatButton btnDownload;
    @BindView(R.id.progress)
    ProgressBar progress;
    @BindView(R.id.progress_text)
    TextView progressText;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_download);
        ButterKnife.bind(this);
        context = this;
    }

    @Override
    public void initData() {
    }

    @Override
    public void initView() {
        new AppToolBar(this, idToolbar, "文件下载");
    }

    @Override
    public void initLoad() {
    }

    @OnClick(R.id.btn_download)
    public void onViewClicked() {
        DownloadDialogFragment downloadDialogFragment = DownloadDialogFragment.newInstance();
        downloadDialogFragment.show(getSupportFragmentManager(), "DownloadActivity");
        Intent intent = new Intent(this, DownloadService.class);
        intent.putExtra("url", "http://www.ftxkeji.com/ftx_v1.2.3.apk");
        startService(intent);
    }
}
